/**
 * <pre>
 * Title: 		UserController.java
 * Author:		linriqing
 * Create:	 	2010-5-28 下午02:20:13
 * Copyright: 	Copyright (c) 2010
 * Company:		Shenzhen Helper
 * <pre>
 */
package com.hengpeng.itfinoss.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hengpeng.itfinbase.persist.AppRole;
import com.hengpeng.itfinoss.domain.PersistCollectionEditor;
import com.hengpeng.itfinoss.service.ServiceFactory;

/**
 * <pre>
 * 用户控制器
 * </pre>
 * @author linriqing
 * @version 1.0, 2010-5-28
 */
@Controller
@RequestMapping(value = "/um")
public class UserManageController
{
	@Autowired
	private ServiceFactory serviceFactory;
	@InitBinder
	public void initBinder(WebDataBinder binder)
	{
		binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm"), false));
		binder.registerCustomEditor(Set.class, "roles", new PersistCollectionEditor(Set.class, AppRole.class,
				serviceFactory));
	}
}
